from django.db import models


# Create your models here.


# 用户表
class T_user(models.Model):
    id = models.AutoField('用户ID', primary_key=True)
    username = models.CharField('用户名', max_length=25)
    password = models.CharField('密码', max_length=25)
    name = models.CharField('昵称', max_length=25)
    sex = models.CharField('性别', max_length=4, null=True)
    email = models.CharField('邮箱', max_length=20, null=True)
    birthday = models.DateField('生日', null=True)
    career = models.CharField('职业', max_length=20, null=True)
    avatar = models.CharField('头像地址', max_length=255, null=True)
    time = models.DateTimeField('注册时间', auto_now_add=True, null=True)
    remark = models.CharField('个人简介', max_length=45, null=True)

    class Meta:
        verbose_name_plural = '用户表'


# 点赞信息
class T_parise(models.Model):
    id = models.AutoField('ID', primary_key=True)
    media_id = models.IntegerField('娱乐ID')
    user_id = models.IntegerField('用户ID')
    # 默认type为0，指对电影的点赞；若为1，则指对图片的点赞
    type = models.IntegerField('电影/图片', default=0)
    time = models.DateTimeField('点赞时间', auto_now_add=True)
    remark = models.CharField('备注', max_length=45, null=True)

    class Meta:
        verbose_name_plural = '点赞信息表'


# 收藏信息
class T_star(models.Model):
    id = models.AutoField('ID', primary_key=True)
    media_id = models.IntegerField('娱乐ID')
    user_id = models.IntegerField('用户ID')
    type = models.IntegerField('电影/图片', default=0)
    time = models.DateTimeField('收藏时间', auto_now_add=True)
    remark = models.CharField('备注', max_length=45, null=True)

    class Meta:
        verbose_name_plural = '收藏信息表'


# 评论信息
class T_comment(models.Model):
    id = models.AutoField('ID', primary_key=True)
    user_id = models.IntegerField('用户ID')
    type = models.IntegerField('电影/图片', default=0)
    username = models.CharField('用户名', max_length=25)
    content = models.TextField('评论内容')
    time = models.DateTimeField('评论时间', auto_now_add=True)
    media_id = models.IntegerField('娱乐ID')
    reply_id = models.IntegerField('回复ID', default=-1)
    parise_num = models.IntegerField('点赞数', default=0)
    comment_num = models.IntegerField('评论数', default=0)
    remark = models.CharField('备注', max_length=45, null=True)

    class Meta:
        verbose_name_plural = '评论信息表'


# 评分表
class T_rating(models.Model):
    id = models.AutoField('ID', primary_key=True)
    media_id = models.IntegerField('娱乐ID', null=True)
    user_id = models.IntegerField('用户ID', null=True)
    type = models.IntegerField('电影/图片', default=0)
    rating = models.FloatField('评分', null=True)
    time = models.DateTimeField('评分时间', auto_now_add=True)
    remark = models.CharField('备注', max_length=45, null=True)

    class Meta:
        verbose_name_plural = '评分表'


# 下载表
class T_download(models.Model):
    id = models.AutoField('ID', primary_key=True)
    user_id = models.IntegerField('用户ID')
    picture_id = models.IntegerField('图片ID')
    time = models.DateTimeField('下载时间', auto_now_add=True, null=True)
    remark = models.CharField('备注', max_length=45, null=True)

    class Meta:
        verbose_name_plural = '下载表'


# 用户推荐表
class T_recomment(models.Model):
    id = models.AutoField('ID', primary_key=True)
    user_id = models.IntegerField('用户ID', )
    recommend_id = models.CharField('推荐ID', max_length=255, null=True)

    class Meta:
        verbose_name_plural = '推荐表'

